import http from '@/utils/request'

// 用户相关接口
export const userApi = {
	//获取token
	getToken() {
		return http.get('/api/front/hitch/driverInfo/getAccessToken')
	},
	// 车主登录
	ownerLogin(data) {
		console.log(data, 'data')
		return http.post(`/api/front/hitch/driverInfo/miniLogin`, data)
	},
	//车主注册
	ownerRegister(data) {
		return http.post(`/api/front/hitch/driverInfo/registerMiniDriverUser`, data)
	},
	//实名认证
	ownerCertification(data) {
		return http.post(`api/front/hitch/driverInfo/realNameAuth`, data)
	}
}

//乘客

export const passenger = {
	getAllAddresses() {
		return http.get('/api/front/hitch/passengerManager/getAllAddresses')
	},
	selectShiMing() {
		return http.get('/api/front/hitch/passengerManager/selectShiMing')
	},
	selectAllChangYong() {
		return http.get('/api/front/hitch/passengerManager/selectAllChangYong')
	},
	updateOrderSuccess(id) {
		return http.get(`/api/front/hitch/passengerManager/updateOrderSuccess?id=` + id)
	},
	insertGpOrderVo(data) {
		return http.post(`/api/front/hitch/passengerManager/insertGpOrderVo`, data)
	},
	selectMoneyByUserId() {
		return http.get(`/api/front/hitch/passengerManager/selectMoneyByUserId`)
	},
	updateUserMoney(data) {
		return http.post(`/api/front/hitch/passengerManager/updateUserMoney`, data)
	},
	selectConfigChengCheAZuoWei() {
		return http.get(`/api/front/hitch/passengerManager/selectConfigChengCheAZuoWei`)
	},
	updateUserChengKe(data) {
		return http.post(`/api/front/hitch/passengerManager/updateUserChengKe`, data)
	},
	addUserChengKe(data) {
		return http.post(`/api/front/hitch/passengerManager/addUserChengKe`, data)
	},
	deleteUserChengKe(id) {
		return http.delete("/api/front/hitch/passengerManager/deleteUserChengKe?id=" + id)
	},
	selectUserChengCheRens() {
		return http.get('/api/front/hitch/passengerManager/selectUserChengCheRens')
	},
	selectCheCi(xuanZeCheCiVo) {
		return http.post(`/api/front/hitch/passengerManager/selectCheCi`, xuanZeCheCiVo)
	},
	selectJiaPiaoShuJu(xuanZeRiQiVo) {
		return http.post(`/api/front/hitch/passengerManager/selectJiaPiaoShuJu`, xuanZeRiQiVo)
	},
	selectXiangXi(dataStr) {
		return http.get("/api/front/hitch/passengerManager/selectXiangQing?dataStr=" + dataStr);
	},
	//登录
	login(data) {
		return http.post(`/api/front/hitch/passengerManager/miniLogin`, data)
	},
	//预估车费
	estimatedFee(data) {
		return http.post(`/api/front/hitch/passengerManager/estimateFee`, data)
	},
	//预约订单
	reservationOrder(data) {
		return http.post(`/api/front/hitch/passengerManager/createOrder`, data)
	},

	//预约订单
	getPaymentInfo(data) {
		return http.post(`/api/front/hitch/pay/payment`, data)
	},

	// 添加紧急联系人
	addUserJinJi(data) {
		return http.post(`/api/front/hitch/pay/payment`, data);
	}
}

//车主注册
export const owneRegister = {
	//实名认证
	realNameAuth(data) {
		return http.post(`/api/front/hitch/driverInfo/realNameAuth?name=` + data.name + `&idCard=` + data.idCard +
			`&uid=` + data.uid)
	},

	//获取车辆认证信息
	getCarInfoDetail() {
		return http.get(`/api/front/hitch/driverInfo/getCarInfoDetail`)
	},

	//上传文件通用
	uploadFileHandle(data) {
		return http.post(`/api/front/hitch/driverInfo/uploadFileHandle`, data)
	},

	//驾驶证认证
	uploadDriverLicense(data) {
		return http.uploadPost(`/api/front/hitch/driverInfo/uploadDriverLicense`, data)
	},

	//驾驶证提交
	submitDriverLicense(data) {
		return http.post(`/api/front/hitch/driverInfo/submitDriverLicense`, data)
	},

	//行驶证提交
	submitVehicleLicense(data) {
		return http.post(`/api/front/hitch/driverInfo/submitVehicleLicense`, data)
	},

	//行驶证认证
	uploadVehicleLicense(data) {
		return http.post(`/api/front/hitch/driverInfo/uploadVehicleLicense`, data)
	},

	//车辆图片认证
	uploadCarLicense(data) {
		return http.post(`/api/front/hitch/driverInfo/uploadCarLicense`, data)
	},

	//车辆认证提交
	submitCarInfo() {
		return http.post(`/api/front/hitch/driverInfo/submitCarInfo`)
	},

	//车辆认证提交
	submitCarInfoPay(data) {
		let res = http.post(`/api/front/hitch/pay/deposit/payment`, data);
		console.log(res, 123)
		return res;
	}



}


/**
 * 家/公司地址
 */

export function getAddressInfo(addressType) {
	return http.get('/api/front/hitch/address/user_id/addressList/' + addressType);
}

/**
 * 加入收藏地址
 */

export function setCollectAddress(data) {
	return http.post('/api/front/hitch/address/user_id/collectAddress', data);
}